<include file='Shop:header_shoping' title='' />
<style type="text/css">
</style>
<!--//End-slider-script -->
<div id="top" class="callbacks_container">
	<div class="courses_box3">
		<div class="col-md-8 about_left">
			<img src="__PUBLIC__/img/shoping/banner.png" class="img-responsive" alt="" />
		</div>
		<div class="col-md-4 about_right">
			<div class="form-group">
				<h4>
					<a href="index.html">
						<img src="__PUBLIC__/img/shoping/yh.png" width="20px" height="20px" alt="" />
						新用户注册
					</a>
				</h4>
				<input type="text" class="form-control" name="telephone" id="telephone" placeholder="请输入手机号" />
				<input type="text" class="form-control" name="img_verify" id="img_verify" placeholder="图片验证码" style="width: 70%;float: left;margin-top: 0px;" />
                <span style="float: left;margin-left: 4%;width: 25%;"><img style="float:left;margin-top:5px;height:30px; width:50px" src='./index.php/shop/getImageVerify' onclick="javascript:$(this).attr('src', './index.php/shop/getImageVerify?'+Math.random());" title="点击切换图片"/></span>
				<if condition = "$is_code">
					<div class="form_contear">
						<div class="col-sm-6">
							<input type="text" class="form-control" name="code" id="code" placeholder="请输入验证码"/>
						</div>
						<div class="col-sm-6">
							<button type="button" class="btn btn-lg center-block" id="get_verify">
								获取验证码
							</button>
						</div>
					</div>
				</if>
				<input type="text" class="form-control" name="name" id="name" placeholder="请输入姓名" />
				<input type="password" class="form-control" name="password" id="password" placeholder="设置密码" />
				<input type="password" class="form-control" id="confirm_password" placeholder="确认密码" />
				<input class="form-grounp" id="confirm" value="注册" type="button">
				<p class="action-forgot-password ">
					已有账号？
					<a class="action-link" href="{:U(shop/login)}">
						去登录
					</a>
				</p>
			</div>
		</div>
	</div>
	<div class="clearfix">
	</div>
</div>
<script type="text/javascript">
	$('#confirm').on('click',
	function() {
		var telephone = $('#telephone').val();
		var img_verify = $('#img_verify').val();
		var code = $('#code').val();
		var is_code = '{$is_code}';
		var name = $('#name').val();
		var password = $('#password').val();
		var confirm_password = $('#confirm_password').val();
		if (telephone == '' || telephone == null || !checktelephone(telephone)) {
			alert('请输入正确的手机号码');
			$("#telephone").focus();
			return false;
		}
		if (code == '' || code == null && is_code == 1) {
			alert('请输入您的短信验证码');
			return false;
		}
		if (name == '' || name == null) {
			alert('请输入您的姓名');
			$("#name").focus();
			return false;
		}
		// isBirthdate= /^[\w\W]{6,}$/.test(password); 
		// if(isBirthdate == 0){
		// 	alert('密码由6位以上数字，字母或特殊字符组成');
		// 	return false;
		// }
		if(confirm_password != password ){
			alert('两次密码输入不一致');
			$("#confirm_password").focus();
			return false;
		}
		
		if (password != '' && password != null) {
			// $('form').submit();
			$.ajax({
                url:'{:U('shop/register')}',
                data: {
                    telephone:telephone,
                    name:name,
                    password:password,
                    img_verify:img_verify
                },
                type:'post',
                dataType:'json',
                success:function(data){
                    if(data.status == 1){
                        alert('注册成功！');
                        window.location.href = "{:U('shop/index')}";
                    }else{
                        alert(data.info);
                        return false;
                    }
                },
                error:function(data){
                    alert(data.info);
                    return false;
                }
            });
		} else {
			alert('请重新检查您的密码');
		}
	});
	function checktelephone(telephone) {
        var filter  = /^1[3578][0-9]{9}$/;
        if (filter.test(telephone)){
            return true;
        }else{
            return false;
        }
    }
</script>
<div class="barck">
	<h3 class="section-title">
		如何下单？
	</h3>
	<section class="how-it-works home-section">
		<div>
			<img class="img-block" alt="" src="__PUBLIC__/img/shoping/icon.png">
		</div>
		<input class="form-contr" id="" value="开始下单" type="button">
	</section>
</div>
<div class="clearfix">
</div>
<!-- <script src="__PUBLIC__/js/responsiveslides.min.js"></script> -->
<script>
	// $(function() {
	// 	$("#slider3").responsiveSlides({
	// 		auto: true,
	// 		pager: true,
	// 		nav: true,
	// 		speed: 500,
	// 		namespace: "callbacks",
	// 		before: function() {
	// 			$('.events').append("<li>before event fired.</li>");
	// 		},
	// 		after: function() {
	// 			$('.events').append("<li>after event fired.</li>");
	// 		},
	// 	});
	// });
	// var url = window.location.hash;
	// $("html,body").animate({
	// 	scrollTop: $(url).offset().top
	// },
	// 1000);
</script>
<include file='Shop:footer_shoping' />